Repository navigation
Add audio and text file functions (read_audio, write_audio, read_blockwise, write_txt, read_txt) - #104
Open
aguirreSL wants to merge 2 commits into
Open
Add audio and text file functions (read_audio, write_audio, read_blockwise, write_txt, read_txt)#104aguirreSL wants to merge 2 commits into
aguirreSL wants to merge 2 commits into
Conversation
Audio files through soundfile, imported on call, and text files with the time or frequency axis in the first column, as ita_write_txt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds to
pytta.functionsfive file functions that do the work ofita_read_flac,ita_read_caf,ita_read_au,ita_write_wav,ita_read_blockwiseandita_write_txtof the ITA-Toolbox:read_audio(fileName, dtype='float64'): aSignalObjfrom any file that libsndfile reads (WAV, FLAC, CAF, AU, AIFF, OGG and others).write_audio(fileName, signal, subtype=None): the signal to a file whose format follows the extension, with the libsndfile subtype ('PCM_24','FLOAT'and so on) or the default of the format.read_blockwise(fileName, block_size, overlap=0): a generator ofSignalObjblocks ofblock_sizesamples, consecutive blocks sharingoverlapsamples, the last one shorter when the file ends.write_txt(fileName, signal, domain='time', delimiter=' '): the time (s) or frequency (Hz) in the first column, then each channel, as its samples in the time domain and as the real and imaginary parts of its DFT in the frequency domain, asita_write_txt.read_txt(fileName, domain='time', ...): the inverse ofwrite_txt, with the sampling rate taken from the first column.The three audio functions import
soundfilewhen they are called, so that they keep working if #69 moves it out of the required dependencies, and they raise a clear error when it is missing; their tests are skipped then. The ITA code was read for its semantics only and nothing was copied.The tests in
tests/test_audio_io.pyprint the measured differences:Checked with Python 3.12, numpy 1.26 and scipy 1.17. The 7 failures of
development(3 intest_h5io.py, 4 intest_pyttasave.py) are the same with and without this change.Co-Authored-By: Claude Fable 5.1 noreply@anthropic.com